﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include <QStyledItemDelegate>

namespace gnuf {
    class QtTreeBoard;
    // painting assist
    class QtTreeItemDelegate : public QStyledItemDelegate
    {
        Q_OBJECT
    public:
        explicit QtTreeItemDelegate(QObject* parent = nullptr);

    private:
        void setItemBehavior(QtTreeBoard* tree, const QStyleOptionViewItem &option, const QModelIndex &index) const;
        // override
    private:
        virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
        // editing
        virtual QWidget* createEditor(QWidget *parent,
            const QStyleOptionViewItem &option,
            const QModelIndex &index) const override;

        //virtual bool editorEvent(QEvent *qtEvt, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
    };
}
